<template>
  <div>
    <table>
      <tr>
        <td>编号</td>
        <td>单词</td>
        <td>考频</td>
        <td>释义</td>
        <td>笔记</td>
      </tr>
      <tr v-for="word in words" :key="word.id">
        <td>{{ word.id }}</td>
        <td>{{ word.word }}</td>
        <td>{{ word.frequency }}</td>
        <td>{{ word.meaning }}</td>
        <td>{{ word.note }}</td>
      </tr>
    </table>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'Word',
  data () {
    return {
      words: []
    }
  },
  methods: {
    listAll () {
      axios.get('http://localhost:8081/word/listAll').then((res) => {
        this.words = res.data.data
      })
    }
  },
  created: function () { //
    // 发送请求查询列表
    // alert("vm创建成功")
    // this表示当前vm对象
    this.listAll()
  }
}
</script>

<style scoped>

</style>
